package sfeir.ergosum.adapter;

import sfeir.ergosum.R;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

public class GalleryAdapter extends BaseAdapter {

	int mGalleryItemBackground;
	private Context mContext;

	public final static int PHONE = 0;
	public final static int MAIL = 1;
	public final static int WEB = 2;
	public final static int ALL = 3;
	public final static int ADDRESS = 4;
	public final static int ABOUT = 5;

	private int[] mImageIds = { R.drawable.phone_mobile, R.drawable.email_pro,
			R.drawable.web, R.drawable.small_icon, R.drawable.house, R.drawable.about };

	public GalleryAdapter(Context c) {
		mContext = c;
		// TypedArray a = obtainStyledAttributes(android.R.styleable.Theme);
		// mGalleryItemBackground =
		// a.getResourceId(android.R.styleable.Theme_galleryItemBackground, 0);
		// a.recycle();

		// TypedArray a = obtainStyledAttributes(android.R.style.Theme_Light,
		// mImageIds);
	}

	public int getCount() {
		return mImageIds.length;
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView i = new ImageView(mContext);

		i.setImageResource(mImageIds[position]);
		i.setLayoutParams(new Gallery.LayoutParams(80, 50));

		i.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
		i.setBackgroundResource(mGalleryItemBackground);

		return i;
	}

}
